import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.*;
import java.io.IOException;
import java.nio.file.StandardCopyOption;
import java.util.List;
public class Main {
    public static void main(String[] args) {
//        Path sourcePath = Paths.get("E:\\video2\\篮球技巧.mp4");
//        Path destinationPath = Paths.get("E:\\test.mp4");
//        try{
//            Files.copy(sourcePath,destinationPath, StandardCopyOption.REPLACE_EXISTING);
//            System.out.println("文件拷贝成功！");
//        }catch (IOException e){
//            System.out.println("拷贝文件发生错误："+e.getMessage());
//        }
        test3();
    }
    public static void test2(){
        File sourceFile = new File("E:\\video2\\篮球技巧.mp4");
        File destinationFile = new File("E:\\test.mp4");
        try(FileInputStream fis = new FileInputStream(sourceFile);
            FileOutputStream fos = new FileOutputStream(destinationFile)){
            byte[] buffer = new byte[1024];
            int bytesRead;
            while ((bytesRead = fis.read(buffer))!=-1){
                fos.write(buffer,0,bytesRead);
            }
            System.out.println("文件拷贝成功");
        }catch (IOException e){
            System.out.println("文件拷贝错误："+e.getMessage());
        }
    }
    public static void test3(){
        try(/*FileWriter fw = new FileWriter("E:\\test.txt")*){*/
            FileReader fr = new FileReader("E:\\test.txt")){
//            fw.write("嘻嘻");
            //System.out.println("输入成功！");
           int r;
           while((r = fr.read())!=-1){
               System.out.println(r);
           }

        }catch (IOException e){
            System.out.println("输入失败："+e.getMessage());
        }
    }

}